package com.swufestu.hello;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class BallActivity extends AppCompatActivity {

    private static final String TAG = "wwwwww";
    EditText input;
    TextView out;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ball);
        Log.i("11111","onCreate:start running!");
        Log.i(TAG,"onCreate:");
        Log.i(TAG,"onCreate:");
        input = findViewById(R.id.input);//必须放在函数里
    }

    public void myclicka(View btn){
        Log.i(TAG,"OnClick:AAAAAAA");
        Double number = Double.parseDouble(input.getText().toString());
        if(btn.getId()==R.id.btn1){
            number = 0.1548*number;
        }else if(btn.getId()==R.id.btn2){
            number = 0.1324*number;
        }else if(btn.getId()==R.id.btn3){
            number = 5.1688*number;
        }else{
            number = 11.0;
        }
        out = findViewById(R.id.res);
        out.setText(String.valueOf(number));
    }

}